﻿#region License statement
// NJamb, a specification and delta-specification DSL
// Copyright (c) 2010-2011, Mark Knell
// Published under the MIT License; all other rights reserved
#endregion

#region using...
using NJamb.Specifications;
using Stile.Patterns.SelfDescribingPredicates;
using Stile.Patterns.SelfDescribingPredicates.Evaluators;
#endregion

namespace NJamb.Parser.SpecificationBuilders.SubjectIs.Extensions
{
    public static class IsBoolExtensions
    {
        public static TSpecifies False<TSpecifies>(this IFluentIs<bool, TSpecifies> collaboratingIs)
            where TSpecifies : class, ISpecification<bool>
        {
            Evaluator<bool> evaluator = Expect<bool>.ToBeFalse(collaboratingIs.Xray.Negated);
            TSpecifies specifies = collaboratingIs.Xray.SpecificationBuilder.Specify(evaluator);
            return specifies;
        }

        public static TSpecifies True<TSpecifies>(this IFluentIs<bool, TSpecifies> collaboratingIs)
            where TSpecifies : class, ISpecification<bool>
        {
            Evaluator<bool> evaluator = Expect<bool>.ToBeTrue(collaboratingIs.Xray.Negated);
            TSpecifies specifies = collaboratingIs.Xray.SpecificationBuilder.Specify(evaluator);
            return specifies;
        }
    }
}
